import React, { Component } from 'react';
import { List } from 'antd-mobile';
import { observer } from 'mobx-react';

import Order from '../../models/order.js';


import './index.css';

const Item = List.Item;

@observer
class OrderList extends Component {
	constructor(props) {
		super(props);
	}
	componentDidMount() {
		Order.getOrderList();
	}
	render() {
		const { list } = Order.orders;
		const items = list.map((item) => {
			return (
				<Item key={item.id} extra={item.create_date} className="list-content">
		     		{ item.total }
		     	</Item>
			)
		})
		return (
			 <List renderHeader={() => '订单列表'} className="my-list">
		     	{ items }
		     </List>
		)
	}
}

export default OrderList